//
//  userInfoModel.m
//  XYMaterial
//
//  Created by 肖扬 on 15/12/11.
//  Copyright © 2015年 肖扬. All rights reserved.
//

#import "userInfoModel.h"
#import "loginModel.h"
@implementation userInfoModel
@synthesize data;
-(id)init{
    self = [super init];
    if (self) {
        self.data = [NSMutableDictionary dictionary];
    }
    return self;
}
-(void)parseResponseData:(NSString *)responseString{
    [super parseResponseData:[responseString objectFromJSONString]];
    NSMutableDictionary *dic = [responseString objectFromJSONString];
    NSMutableDictionary *member = [dic objectForKey:@"member"];
    NSMutableDictionary *company = [dic objectForKey:@"company"];
    if ([member count]) {
        loginModelObj *userInfo = [[loginModelObj alloc]init];
        userInfo.nickname = [member objectForKey:@"nickname"];
        userInfo.mobile = [member objectForKey:@"mobile"];
        userInfo.mobile_verified = [member objectForKey:@"mobile_verified"];
        userInfo.company_name = [member objectForKey:@"company_name"];
        userInfo.qq = [member objectForKey:@"qq"];
        
        userInfo.email = [member objectForKey:@"email"];
        userInfo.status = [member objectForKey:@"status"];
        userInfo.dealer = [member objectForKey:@"dealer"];
        userInfo.referee = [member objectForKey:@"referee"];
        userInfo.certificate = [member objectForKey:@"certificate"];
        
        userInfo.mid = [member objectForKey:@"mid"];
        userInfo.client_model = [member objectForKey:@"client_model"];
        userInfo.client_os = [member objectForKey:@"client_os"];
        userInfo.client_os_version = [member objectForKey:@"client_os_version"];
        userInfo.client_latitude = [member objectForKey:@"client_latitude"];
        
        userInfo.client_longitude = [member objectForKey:@"client_longitude"];
        userInfo.client_device = [member objectForKey:@"client_device"];
        userInfo.app_version = [member objectForKey:@"app_version"];
        userInfo.ctime = [member objectForKey:@"ctime"];
        [self.data setObject:userInfo forKey:@"member"];
    }
    if ([company count]) {
        userInfoModelObj *model = [[userInfoModelObj alloc]init];
        model.company_name = [company objectForKey:@"company_name"];
        model.country = [company objectForKey:@"country"];
        model.province = [company objectForKey:@"province"];
        model.city = [company objectForKey:@"city"];
        model.address = [company objectForKey:@"address"];
        
        model.business = [company objectForKey:@"business"];
        model.tel_pre = [company objectForKey:@"tel_pre"];
        model.tel = [company objectForKey:@"tel"];
        model.license_code = [company objectForKey:@"license_code"];
        model.license_file = [company objectForKey:@"license_file"];
        
        model.license_audit_id = [company objectForKey:@"license_audit_id"];
        model.intro = [company objectForKey:@"intro"];
        model.zipcode = [company objectForKey:@"zipcode"];
        model.company_site = [company objectForKey:@"company_site"];
        [self.data setObject:model forKey:@"company"];
    }

}
-(void)dealloc{
    [self.data removeAllObjects];
    self.data = nil;
}
@end

@implementation userInfoModelObj

@synthesize company_name,country,province,city,address;
@synthesize business,tel_pre,tel,license_code,license_file;
@synthesize license_audit_id,intro,zipcode,company_site;
-(void)dealloc{
    self.company_name = nil;
    self.country = nil;
    self.province = nil;
    self.city = nil;
    self.address = nil;
    
    self.business = nil;
    self.tel_pre = nil;
    self.tel = nil;
    self.license_code = nil;
    self.license_file = nil;
    
    self.license_audit_id = nil;
    self.intro = nil;
    self.zipcode = nil;
    self.company_site = nil;
}
@end
